#include <iostream>
#include <signal.h>
#include <cstdio>
#include <unistd.h>

using namespace std;

void Count(int cnt)
{
    while(cnt)
    {
        printf("cnt: %2d\r",cnt);
        fflush(stdout);
        cnt--;
        sleep(1);
    }
    printf("\r");
}

void handler(int signo)
{
    cout << "get a signo: " << signo << endl;
    sleep(20);
}

int main()
{
    struct sigaction act, oldact;
    act.sa_handler = handler;
    act.sa_flags = 0;
    sigemptyset(&act.sa_mask);
    sigaddset(&act.sa_mask,3);
    sigaction(SIGINT, &act, &oldact);
    while (true)
    {
        sleep(1);
    }
    return 0;
}